﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WqLunTan.Areas.Manage.Models
{
    /// <summary>
    /// 分页模型
    /// </summary>
    public class PageModel
    {

        /// <summary>
        /// 当前页索引, 默认为1
        /// </summary>
        public int CurrentPageIndex { get; set; } = 1;

        /// <summary>
        /// 页大小, 默认为20
        /// </summary>
        public int PageSize { get; set; } = 20;

        /// <summary>
        /// 总记录数量
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 分页按钮个数
        /// </summary>
        public int PageButtonCount { get; set; } = 10;

        /// <summary>
        /// 多少页, 只读
        /// </summary>
        public int PageCount
        {
            get
            {
                if (TotalCount % PageSize == 0)
                {
                    return TotalCount / PageSize;
                }
                else
                {
                    return TotalCount / PageSize + 1;
                }
            }
        }
    }
}
